<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <base href="${basePath}" target="_self"/>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>角色列表</title> 
    <#include "/template/head.html">
    <script type="text/javascript">
    $(function() {
      var curPageNo = ${pagination.pageNo};
      var totalPage = ${pagination.totalPage};
      var _pageNo = $('#pageNo'), _pageForm = $('#roleListForm');
      var _first = $('#first'),  _back = $('#back'), _next = $('#next'), _last = $('#last');
      
      if(curPageNo> 1){
      	_first.click(function() {
          _pageNo.val(1);
          _pageForm.submit();
        });
      	_first.addClass('pointer');
        _back.click(function() {
          _pageNo.val(parseInt(curPageNo)-1);
          _pageForm.submit();
        });
        _back.addClass('pointer');
      }
      
      if(curPageNo < totalPage){
      	_last.click(function() {
          _pageNo.val(totalPage);
          _pageForm.submit();
        });
        _last.addClass('pointer');
        _next.click(function() {
          _pageNo.val(parseInt(curPageNo)+1);
          _pageForm.submit();
        });
        _next.addClass('pointer');
      }
      
      _pageForm.validate({
        rules:{
          pageSize: {required:true, min:1},
          pageNo: {range:[1,totalPage]}
        },
        messages:{
          pageSize: {required: "每页要显示多少条数据", min: "每页最少显示一条数据"},
          pageNo: {range: "页码范围在1和" + totalPage + "之间"}
        },
        errorPlacement: function(error, element) {   
          alert(error.html());
        }
      });
    });
    </script>
  </head>

  <body>
    <form id="roleListForm" action="${basePath}admin/role/list.do" method="post">
      <table class="cmxform" cellspacing="1">
        <tr>
          <th width="70">角色名称：</th>
          <td width="120"><input name="roleName" value="${role.roleName}"/></td>
          <td><button type="submit" class="search"/></td>
          <td width="62"><a href="${basePath}admin/role/add.do"><img src="img/add.png" class="noborder"/></a></td>
        </tr>
      </table>
      <table>
        <tr>
          <td>
            <table width="100%">
              <tr>
                <td width="15" height="30" style="background: url('img/tab_03.gif') no-repeat;">&nbsp;</td>
                <td style="background: url(${basePath}img/tab_05.gif) repeat-x ;">
                  <img src="img/311.gif" width="16" height="16" />
                  <h5 class="inline shadow">角色列表</h5>
                </td>
                <td width="14" height="30" style="background: url('img/tab_07.gif') no-repeat;">&nbsp;</td>
              </tr>
            </table>
          </td>
        </tr>
        <tr>
          <td>
            <table width="100%">
              <tr>
                <td style="background: url(img/tab_12.gif);width: 9px;">&nbsp;</td>
                <td style="background: #f3ffe3;">
                  <table class="list" cellspacing="1" onmouseover="changeto();" onmouseout="changeback();">
                    <thead>
                      <tr>
                        <th>序号ID</th>
                        <th>角色名称</th>
                        <th>新增病人信息卡</th>
                        <th>修改病人信息卡</th>
                        <th>删除病人信息卡</th>
                        <th>退回病人信息卡</th>
                        <th>新增药敏结果</th>
                        <th>修改药敏结果</th>
                        <th>删除药敏结果</th>
                        <th>超级管理员</th>
                        <th width="100" nowrap="nowrap">操作</th>
                      </tr>
                    </thead>
                    <#list pagination.list as r>
                    <tr style="background: #FFF">
                      <td>${r.id}</td>
                      <td>${r.roleName}</td>
                      <td><#if r.addBrxx><span style="color:green;">允许</span><#else><span style="color:red;">禁止</span></#if></td>
                      <td><#if r.editBrxx><span style="color:green;">允许</span><#else><span style="color:red;">禁止</span></#if></td>
                      <td><#if r.delBrxx><span style="color:green;">允许</span><#else><span style="color:red;">禁止</span></#if></td>
                      <td><#if r.cancelBrxx><span style="color:green;">允许</span><#else><span style="color:red;">禁止</span></#if></td>
                      <td><#if r.addYmjg><span style="color:green;">允许</span><#else><span style="color:red;">禁止</span></#if></td>
                      <td><#if r.editYmjg><span style="color:green;">允许</span><#else><span style="color:red;">禁止</span></#if></td>
                      <td><#if r.delYmjg><span style="color:green;">允许</span><#else><span style="color:red;">禁止</span></#if></td>
                      <td><#if r.admin><span style="color:green;">允许</span><#else><span style="color:red;">禁止</span></#if></td>
                      <td nowrap="nowrap">
                        <img src="img/037.gif" width="9" height="9" />
                        <span> [</span><a href="${basePath}admin/role/edit.do?id=${r.id}">编辑</a><span>]</span>
                        <img src="img/010.gif" width="9" height="9" />
                        <span> [</span><a href="${basePath}admin/role/delete.do?id=${r.id}" onclick="if(!confirm('你确定要删除该角色吗？')){return false;}">删除</a><span>]</span>
                      </td>
                    </tr>
                    </#list>
                  </table>
                </td>
                <td style="background: url(${basePath}img/tab_16.gif); width: 9px;">&nbsp;</td>
              </tr>
            </table>
          </td>
        </tr>
        <tr>
          <td>
            <table width="100%">
              <tr>
                <td width="15" height="29" style="background: url('img/tab_20.gif') no-repeat;">&nbsp;</td>
                <td style="background: url(img/tab_21.gif) repeat-x;">
                  <table>
                    <tr>
                      <td width="25%" height="29" nowrap="nowrap">
                        <span>共${pagination.totalCount}条纪录，当前第${pagination.pageNo}/${pagination.totalPage}页，每页&nbsp;<input name="pageSize" value="${pagination.pageSize}" class="w20" onkeypress="if(event.keyCode==13){$('#roleListForm').submit();}"/>&nbsp;条纪录</span>
                      </td>
                      <td width="100000"></td>
                      <td>
                        <table width="340">
                          <tr align="center" valign="middle" style="height: 22px;">
                            <td width="48"><img id="first" src="img/first.gif" width="37" height="15" /></td>
                            <td width="52"><img id="back" src="img/back.gif" width="43" height="15" /></td>
                            <td width="52"><img id="next" src="img/next.gif" width="43" height="15" /></td>
                            <td width="48"><img id="last" src="img/last.gif" width="37" height="15" /></td>
                            <td width="52">转到第</td>
                            <td width="35"><input id="pageNo" name="pageNo" value="${pagination.pageNo}" style="width: 30px;" onkeypress="if(event.keyCode==13){$('#roleListForm').submit();}"/></td>
                            <td width="23">页</td>
                            <td width="30"><img src="img/go.gif" class="pointer" width="37" height="15" onclick="$('#roleListForm').submit();" /></td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                  </table>
                </td>
                <td width="14" height="29" style="background: url('img/tab_22.gif') no-repeat;">&nbsp;</td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </form>
    <#include "/template/common/alert_message.html"/>
  </body>
</html>
